bipl5

An R Package for Reactive Biplots R





Ruan Buys
Carel van der Merwe
Sugnet Lubbe


<br


SASA 2024

PCA Biplots in bipl5

Enhancing the PCA biplot

PCA with biplotEZ

x<- biplot(data = iris, group.aes = iris[,5],
       Title = "My first biplot") |> 
  PCA() |> 
  plot()

PCA -> bipl5

CVA with biplotEZ

y<- biplot(state.x77) |> 
  CVA(classes = state.region) |> 
  plot()

CVA -> bipl5

PCO with biplotEZ (linear axes)

x<- biplot(rock) |> 
  regress(Z = MASS::sammon(dist(scale(rock), method="manhattan"))$points) |> 
  plot()
# Initial stress        : 0.02554
# stress after  10 iters: 0.01094, magic = 0.500
# stress after  20 iters: 0.01080, magic = 0.500
# stress after  30 iters: 0.01078, magic = 0.500

PCO with biplotEZ (spline axes)

z<- biplot(rock, scale = TRUE) |> PCO(axes = "splines") |> plot()
# Calculating spline axis for variable 1 
# Calculating spline axis for variable 2 
# Calculating spline axis for variable 3 
# Calculating spline axis for variable 4

PCO (spline axes) -> bipl5

biplotEZ Enhancements: Alpha-bag

sunspots <- matrix (sunspot.month[1:(264*12)], ncol = 12, byrow = TRUE)
years <- 1749:2012
rownames(sunspots) <- years
colnames(sunspots) <- c("Jan", "Feb", "Mar", "Apr", "May", "Jun",
                        "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
century <-paste(floor((years-1)/100)+1, ifelse (floor((years-1)/100)+1<21, "th","st"), sep = "-")

x<- biplot(sunspots, group.aes=century) |> PCA() |>
        axes (label.dir = "Hor", label.line = c(0.8, rep(0,10), 0.8)) |>
        alpha.bags () |> 
        legend.type(bags = TRUE)  |> plot()

biplotEZ Enhancements: Alpha-bag

# Computing 0.95 -bag for 18-th 
# Computing 0.95 -bag for 19-th 
# Computing 0.95 -bag for 20-th 
# Computing 0.95 -bag for 21-st

Alpha-bags -> bipl5

Ellipses

x<- biplot(sunspots, group.aes=century) |> PCA() |>
        axes (label.dir = "Hor", label.line = c(0.8, rep(0,10), 0.8)) |>
        samples (which = NULL) |>
        ellipses (alpha = c(0.9, 0.95), lty = c(1,3,5), opacity = 0.1) |> 
        legend.type(ellipses = TRUE)  |> plot()

Ellipses

# Computing 2.15 -ellipse for 18-th 
# Computing 2.15 -ellipse for 19-th 
# Computing 2.15 -ellipse for 20-th 
# Computing 2.15 -ellipse for 21-st 
# Computing 2.45 -ellipse for 18-th 
# Computing 2.45 -ellipse for 19-th 
# Computing 2.45 -ellipse for 20-th 
# Computing 2.45 -ellipse for 21-st

Ellipses -> bipl5